package com.assess.service.impl;

import com.assess.entity.AssessIndicator;
import com.assess.mapper.AssessIndicatorMapper;
import com.assess.service.AssessIndicatorService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AssessIndicatorServiceImpl extends ServiceImpl<AssessIndicatorMapper, AssessIndicator> implements AssessIndicatorService {
    @Override
    public List<AssessIndicator> listByRootId(Long rootId) {
        LambdaQueryWrapper<AssessIndicator> qw = new LambdaQueryWrapper<>();
        qw.eq(rootId != null, AssessIndicator::getRootId, rootId)
          .orderByAsc(AssessIndicator::getRootId, AssessIndicator::getParentId, AssessIndicator::getOrderNum);
        return this.list(qw);
    }
}


